﻿using System.Web.Mvc;
using System.Web.Security;
using Data;

namespace Web.Controllers
{
    public class BaseController : Controller
    {
       
        protected BaseController()
        {

            var dbCategory = new CategoryData();
            ViewBag.Categories = dbCategory.GetCategories();
            var dbTags = new TagsData();
            ViewBag.Tags = dbTags.GetTags();
        }

        protected FormsAuthenticationTicket GetFormsAuthenticationTicket()
        {
            var cookie = Request.Cookies[FormsAuthentication.FormsCookieName];
            if (cookie != null)
            {
                var auth = FormsAuthentication.Decrypt(cookie.Value);
                return auth;
            }
            return null;
        }
    }
}
